﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Space2D_Utils
{
	public class Grid2D
	{
		public Grid2D(AABB aabb, int x, int y)
		{
			m_aabb = aabb;
			m_x = x;
			m_y = y;
		}

		public void Add(AABB aabb)
		{
			int i1 = (int)(((aabb.Position.X - aabb.R.X) - (m_aabb.Position.X - m_aabb.R.X)) * m_x / m_aabb.Size.X);
			int i2 = (int)(((aabb.Position.X + aabb.R.X) - (m_aabb.Position.X - m_aabb.R.X)) * m_x / m_aabb.Size.X);
			int j1 = (int)(((aabb.Position.Y - aabb.R.Y) - (m_aabb.Position.Y - m_aabb.R.Y)) * m_y / m_aabb.Size.Y);
			int j2 = (int)(((aabb.Position.Y + aabb.R.Y) - (m_aabb.Position.Y - m_aabb.R.Y)) * m_y / m_aabb.Size.Y);
		}

		public Dictionary<AABB, List<AABB>> GetGroups()
		{
			return m_groups;
		}

		private Dictionary<AABB, List<AABB>> m_groups = new Dictionary<AABB, List<AABB>>();
		private AABB m_aabb = new AABB();
		private int m_x = 10;
		private int m_y = 10;
	}
}
